package com.example.peibei.ui.adapter;

import android.text.TextUtils;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.HomeBannerCate;
import com.dingtao.common.bean.PayPower;
import com.dingtao.common.bean.SubmitOrder;
import com.example.peibei.R;
import com.example.peibei.bean.PayMethod;

import java.util.List;

public class PayMethodAdapter extends BaseQuickAdapter<PayPower, BaseViewHolder> {
    public int mSelectedItem = 0;

    public PayMethodAdapter() {
        super(R.layout.item_pay_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, PayPower item) {
        helper.setText(R.id.tv_pay_name, item.getName());
        if (TextUtils.equals("0",item.getPayKey())){
            helper.setBackgroundResource(R.id.iv_pay, R.mipmap.qianbao_icon);
        }else if (TextUtils.equals("1",item.getPayKey())){
            helper.setBackgroundResource(R.id.iv_pay, R.mipmap.wechat_icon);
        }else if (TextUtils.equals("2",item.getPayKey())){
            helper.setBackgroundResource(R.id.iv_pay, R.mipmap.ali_pay_icon);
        }
        ImageView checkbox = helper.getView(R.id.checkbox);
        checkbox.setVisibility(mSelectedItem == getItemPosition(item)?View.VISIBLE:View.GONE);
    }

}
